/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - core/threads
// Copyright (c) 2014.  All Rights Reserved
//
// File:		AEEvent.h
// Author:		Gianluca Belardelli
// Date:		12/03/2014
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEEVENT_H_
#define _AEEVENT_H_

class AE_COREDLLIMPEXP AEEvent : public AEWaitableObject
{
// Members
	AE_DECLARE_NON_COPYABLE( AEEvent );

private:
	AEHANDLE	m_hEvent;

public:
	enum AEEventErrors
	{
		AEEvent_FailedInitialize = 0,
		AEEvent_Ok,
		AEEvent_Timeout,
		AEEvent_WaitError,
		AEEvent_SetError
	};

// Methods
public:
	AEEvent( AEBOOL32 bAutoReset, AEBOOL32 bInitialState = FALSE );
	~AEEvent( void );

	AEINT32 Set( void );
	AEINT32 WaitInfinite( void );
	AEINT32 Wait( AEUINT32 uiMilliseconds );
	AEINT32 TryWait( AEUINT32 uiMilliseconds );
	AEINT32 Reset( void );

	virtual AEHANDLE GetHandle( void ) { return m_hEvent; }
};

#endif // _AEEVENT_H_
